package com.designoutput.manager
{
	import com.designoutput.enum.LayerSide;
	import com.designoutput.enum.ToolType;
	import com.designoutput.vo.TextElementFormatVo;

	public class CommandManager extends Object
	{
		private var ed:DesignoutputCard;

		public function CommandManager(parent:DesignoutputCard)
		{
			this.ed=parent;
		}

		/************************** Called in Card/layers************************************/
		public function reSetTool():void
		{
			this.ed.leftToolbar.restore();
		}

		/**
		 * Update options value for a givn element. 
		 * The difference of if set-up value for the last 2 parameters is:
		 * <li>For common type page(or card), it will use the 3 size coordinate to show element position</li>
		 * <li>For T-Shirt type page, it no need use 3 size coordinate to show element position</li>
		 * <li>Especially, when show T-Shirt and Sleeve views meanwhile, it need add a additional value for elements on Sleeve view</li> 
		 * @param elementType A string value to indicate what type of the element. It could reference the AS Class "ElementType"
		 * @param element The target element, such as StarElement, TextElement.
		 * @param bothShirtAndSleeves A Boolean value, to indicate the layers type in Card is mixed with TShirt and Sleeves meanwhile. Default <em>false</em>.
		 * @param forSleeveElements A Boolean value, to indicate if the elements is on Sleeve layers. Default <em>false</em>.
		 * 
		 */		
		public function optionSetValues(elementType:String=null, element:*=null, bothShirtAndSleeves:Boolean=false,forSleeveElements:Boolean=false):void
		{
			this.ed.leftToolbar.optionSetValues(elementType, element,bothShirtAndSleeves,forSleeveElements);
		}

		public function constrainSetMarked(flag:Boolean):void
		{
			this.ed.leftToolbar.constrainSetMarked(flag);
		}

		/***************************** Called in Options **************************************/
		public function changeElementLineSize(lineSize:Number=1):void
		{
			this.ed.canvas.card.changeElementLineSize(lineSize);
		}

		public function changeElementLineColor(lineColor:uint=0):void
		{
			this.ed.canvas.card.changeElementLineColor(lineColor);
		}

		public function changeElementLineAlpha(lineAlpha:Number=1):void
		{
			this.ed.canvas.card.changeElementLineAlpha(lineAlpha);
		}

		public function changeElementFillColor(fillColor:uint=0):void
		{
			this.ed.canvas.card.changeElementFillColor(fillColor);
		}

		public function changeElementFillAlpha(fillAlpha:Number=1):void
		{
			this.ed.canvas.card.changeElementFillAlpha(fillAlpha);
		}

		public function changeElementUseLine(useLine:Boolean=true):void
		{
			this.ed.canvas.card.changeElementUseLine(useLine);
		}

		public function changeElementUseFill(useFill:Boolean=true):void
		{
			this.ed.canvas.card.changeElementUseFill(useFill);
		}

		// for Round Rectangle
		public function changeElementRadius(radius:Number=0):void
		{
			this.ed.canvas.card.changeElementRadius(radius);
		}

		// for Star
		public function changeElementStarPoints(pointsNum:Number=0):void
		{
			this.ed.canvas.card.changeElementStarPoints(pointsNum);
		}

		// for Star
		public function changeElementGroinRatio(ratioNum:Number=0):void
		{
			this.ed.canvas.card.changeElementGroinRatio(ratioNum);
		}

		// for Text Element
		public function setTextFormat(obj:TextElementFormatVo):void
		{
			this.ed.canvas.card.changeTextFormat(obj);
		}
		
		// for Imgae Element
		public function onRestoreProportion():void
		{
			this.ed.canvas.card.changeImageProportion();
		}

		public function changeElementDepth(layoutType:String):void
		{
			this.ed.canvas.card.changeElementDepth(layoutType);
		}

		/******************************Called in Left Tool bar*******************************/
		public function showRuler(flag:Boolean):void
		{
			this.ed.canvas.showRuler(flag);
		}

		public function showCardMargins(flag:Boolean):void
		{
			this.ed.canvas.showCardMargins(flag);
		}

		/**
		 * Only for T-Shirts.
		 * @param vo TShirtOptionViewVo
		 * 
		 */	
		
		public function deleteElements():void
		{
			this.ed.canvas.card.deleteSelectElements();
		}

		/**
		 * 
		 * Disable the options on the Left Tool Bar, the options not visible.
		 */		
		public function disableOptions():void
		{
			this.ed.leftToolbar.addOption(null);
		}
	}
}